package org.mcflier.appuntamento.data.model;

import java.sql.Timestamp;

import org.mcflier.appuntamento.i18n.Language;

public class Torrent {

	private int id;
	private String title, weblink, guid, description, fileFormat, resolution, comment, creator, infoHash, magnetUri, addedBy;
	private Timestamp pubDate, addedDate;
	private long contentLength;
	private TorrentCategory category;
	private TorrentSource source;
	private boolean verified;
	
	private Language language;
	private Movie movie;


	public Torrent(String title, String link, String guid, long contentLength, String description, String fileFormat, String resolution, String comment, TorrentCategory category, TorrentSource source, boolean verified, Timestamp pubDate, String creator, String infoHash, String magnetUri) {
		if(title == null || magnetUri == null || category == null || source == null)
			throw new NullPointerException("Title, magnet link, source and category must not be null");

		this.title = title;
		this.weblink = link;
		this.guid = guid;
		this.description = description;
		this.fileFormat = fileFormat;
		this.resolution = resolution;
		this.comment = comment;
		this.pubDate = pubDate;
		this.category = category;
		this.source = source;
		this.creator = creator;
		this.infoHash = infoHash;
		this.contentLength = contentLength;
		this.magnetUri = magnetUri;
		this.verified = verified;
		
		this.addedDate = null;
		this.addedBy = null;
		
		this.movie = null;
		this.language = null;
		
		this.id = -1;
	}

	public Torrent(String title, String magnetUri, TorrentCategory category, TorrentSource source) {
		if(title == null || magnetUri == null || category == null || source == null)
			throw new NullPointerException("Title, magnet link, source and category must not be null");

		this.title = title;
		this.weblink = null;
		this.guid = null;
		this.description = null;
		this.fileFormat = null;
		this.resolution = null;
		this.comment = null;
		this.category = category;
		this.source = source;
		this.pubDate = null;
		this.contentLength = 0;
		this.creator = null;
		this.infoHash = null;
		this.magnetUri = magnetUri;
		this.verified = false;
		
		this.addedDate = null;
		this.addedBy = null;
		
		this.movie = null;
		this.language = null;
		
		this.id = -1;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getWeblink() {
		return weblink;
	}

	public void setWeblink(String link) {
		this.weblink = link;
	}

	public String getGuid() {
		return guid;
	}

	public void setGuid(String guid) {
		this.guid = guid;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	public String getFileFormat(){
		return this.fileFormat;
	}
	
	public void setFileFormat(String fileFormat){
		this.fileFormat = fileFormat;
	}

	public String getResolution() {
		return resolution;
	}

	public void setResolution(String resolution) {
		this.resolution = resolution;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public Timestamp getPubDate() {
		return pubDate;
	}

	public void setPubDate(Timestamp pubDate) {
		this.pubDate = pubDate;
	}

	public TorrentCategory getCategory() {
		return category;
	}

	public void setCategory(TorrentCategory category) {
		this.category = category;
	}

	public TorrentSource getSource() {
		return source;
	}

	public void setSource(TorrentSource source) {
		this.source = source;
	}

	public String getCreator() {
		return creator;
	}

	public void setCreator(String creator) {
		this.creator = creator;
	}

	public String getInfoHash() {
		return infoHash;
	}

	public void setInfoHash(String infoHash) {
		this.infoHash = infoHash;
	}

	public String getMagnetUri() {
		return magnetUri;
	}

	public void setMagnetUri(String magnetUri) {
		this.magnetUri = magnetUri;
	}

	public long getContentLength() {
		return contentLength;
	}

	public void setContentLength(long contentLength) {
		this.contentLength = contentLength;
	}
	
	public boolean isVerified(){
		return this.verified;
	}
	
	public void setVerified(boolean verified){
		this.verified = verified;
	}
	
	public String getAddedBy() {
		return addedBy;
	}

	public void setAddedBy(String addedBy) {
		this.addedBy = addedBy;
	}

	public Timestamp getAddedDate() {
		return addedDate;
	}

	public void setAddedDate(Timestamp addedDate) {
		this.addedDate = addedDate;
	}

	public Language getLanguage() {
		return language;
	}

	public void setLanguage(Language language) {
		this.language = language;
	}

	public Movie getMovie() {
		return movie;
	}

	public void setMovie(Movie movie) {
		this.movie = movie;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String toString(){
		return this.title+" "+this.magnetUri;
	}
}